package com.koal.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
public class ConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping(value = "/consumer/{str}",method = RequestMethod.GET)
    @ResponseBody
    public String echo(@PathVariable String str) {
        return restTemplate.getForObject("http://nacos-spring-cloud/echo/" + str, String.class);

    }
}
